package com.jxdinfo.hussar.example.qjgl.ryqjsjmx.controller;

import com.jxdinfo.hussar.support.mp.base.controller.HussarBaseController;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.jxdinfo.hussar.support.audit.core.annotations.AuditLog;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.jxdinfo.hussar.support.audit.core.enums.AuditEventGrade;
import com.jxdinfo.hussar.support.audit.core.enums.AuditEventType;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import com.jxdinfo.hussar.example.qjgl.ryqjsjmx.service.RyqjsjmxService;
import org.springframework.beans.factory.annotation.Autowired;
import com.jxdinfo.hussar.example.qjgl.ryqjsjmx.dto.RyqjsjmxDto;
import com.jxdinfo.hussar.example.qjgl.ryqjsjmx.model.Ryqjsjmx;
import com.jxdinfo.hussar.example.qjgl.ryqjsjmx.vo.RyqjsjmxPageVO;
import com.jxdinfo.hussar.platform.core.base.apiresult.ApiResponse;
import org.springframework.web.bind.annotation.RequestBody;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.jxdinfo.hussar.example.qjgl.ryqjsjmx.dto.RyqjsjmxRyqjsjmxdataset1;
import org.springframework.web.bind.annotation.GetMapping;
import com.alibaba.fastjson.JSONObject;

/**
 * 人员请假数据模型控制器
 */
@RestController(value = "qjgl.ryqjsjmx.RyqjsjmxController")
@AuditLog(moduleName = "人员请假数据模型")
@RequestMapping(value = "/qjgl/ryqjsjmx")
public class RyqjsjmxController extends HussarBaseController<Ryqjsjmx, RyqjsjmxService> {

    private static final Logger logger = LoggerFactory.getLogger(RyqjsjmxController.class);

    @Autowired
    private RyqjsjmxService ryqjsjmxService;

    /**
     * 人员请假数据模型表单查询
     */
    @AuditLog(moduleName = "人员请假数据模型", eventDesc = "表单查询", eventGrade = AuditEventGrade.SERVICE_LOG_TYPE, evnetType = AuditEventType.QUERY)
    @GetMapping("formQuery")
    public ApiResponse<Ryqjsjmx> formQuery(@RequestParam(value = "id") String id) {
        return ryqjsjmxService.formQuery(id);
    }

    /**
     * 人员请假数据模型保存流程表单
     */
    @AuditLog(moduleName = "人员请假数据模型", eventDesc = "保存流程表单", eventGrade = AuditEventGrade.SERVICE_LOG_TYPE, evnetType = AuditEventType.INSERT)
    @PostMapping("/flowFormSaveStart")
    public ApiResponse<String> flowFormSaveStart(@RequestBody RyqjsjmxDto ryqjsjmxDto) {
        return ryqjsjmxService.flowFormSaveStart(ryqjsjmxDto);
    }

    /**
     * 人员请假数据模型表格查询（带分页）
     *
     * @param page 分页对象
     * @return 查询结果
     */
    @AuditLog(moduleName = "人员请假数据模型", eventDesc = "表格查询", eventGrade = AuditEventGrade.SERVICE_LOG_TYPE, evnetType = AuditEventType.QUERY)
    @PostMapping("hussarQueryPage")
    public ApiResponse<RyqjsjmxPageVO> hussarQueryPage(@RequestBody Page<Ryqjsjmx> page) {
        return ryqjsjmxService.hussarQueryPage(page);
    }

    /**
     * 人员请假数据模型表格查询（带分页）
     *
     * @param page 分页对象
     * @return 查询结果
     */
    @AuditLog(moduleName = "人员请假数据模型", eventDesc = "表格查询", eventGrade = AuditEventGrade.SERVICE_LOG_TYPE, evnetType = AuditEventType.QUERY)
    @PostMapping("hussarQueryPage_order_custom")
    public ApiResponse<RyqjsjmxPageVO> hussarQueryPage_order_custom(@RequestBody Page<Ryqjsjmx> page) {
        return ryqjsjmxService.hussarQueryPage_order_custom(page);
    }

    /**
     * 人员请假数据模型提交流程表单(优先提交至驳回节点)
     */
    @AuditLog(moduleName = "人员请假数据模型", eventDesc = "提交流程表单(优先提交至驳回节点)", eventGrade = AuditEventGrade.SERVICE_LOG_TYPE, evnetType = AuditEventType.UPDATE)
    @PostMapping(value = "/flowFormSubmitReject")
    public ApiResponse<String> flowFormSubmitReject(@RequestBody RyqjsjmxDto ryqjsjmxDto) {
        return ryqjsjmxService.flowFormSubmitReject(ryqjsjmxDto);
    }

    /**
     * 人员请假数据模型表格查询（带分页）
     *
     * @param ryqjsjmxdataset1 查询对象
     * @return 查询结果
     */
    @AuditLog(moduleName = "人员请假数据模型", eventDesc = "表格查询", eventGrade = AuditEventGrade.SERVICE_LOG_TYPE, evnetType = AuditEventType.QUERY)
    @PostMapping("hussarQueryryqjsjmxCondition_1Page")
    public ApiResponse<RyqjsjmxPageVO> hussarQueryryqjsjmxCondition_1Page(@RequestBody RyqjsjmxRyqjsjmxdataset1 ryqjsjmxdataset1) {
        return ryqjsjmxService.hussarQueryryqjsjmxCondition_1Page(ryqjsjmxdataset1);
    }

    /**
     * 人员请假数据模型表格查询（带分页）
     *
     * @param ryqjsjmxdataset1 查询对象
     * @return 查询结果
     */
    @AuditLog(moduleName = "人员请假数据模型", eventDesc = "表格查询", eventGrade = AuditEventGrade.SERVICE_LOG_TYPE, evnetType = AuditEventType.QUERY)
    @PostMapping("hussarQueryryqjsjmxCondition_1Page_order_custom")
    public ApiResponse<RyqjsjmxPageVO> hussarQueryryqjsjmxCondition_1Page_order_custom(@RequestBody RyqjsjmxRyqjsjmxdataset1 ryqjsjmxdataset1) {
        return ryqjsjmxService.hussarQueryryqjsjmxCondition_1Page_order_custom(ryqjsjmxdataset1);
    }

    /**
     * 人员请假数据模型流程表格修改
     */
    @AuditLog(moduleName = "人员请假数据模型", eventDesc = "流程表单修改权限判断", eventGrade = AuditEventGrade.SERVICE_LOG_TYPE, evnetType = AuditEventType.QUERY)
    @PostMapping(value = "/flowTableUpdate")
    public ApiResponse<JSONObject> flowTableUpdate(@RequestBody RyqjsjmxDto ryqjsjmxDto) {
        return ryqjsjmxService.flowTableUpdate(ryqjsjmxDto);
    }

    /**
     * 人员请假数据模型流程列表物理删除
     */
    @AuditLog(moduleName = "人员请假数据模型", eventDesc = "流程列表物理删除", eventGrade = AuditEventGrade.SERVICE_LOG_TYPE, evnetType = AuditEventType.DELETE)
    @PostMapping("/flowTableDelete")
    public ApiResponse<String> flowTableDelete(@RequestParam(value = "id") String id) {
        return ryqjsjmxService.flowTableDelete(id);
    }

    /**
     * 人员请假数据模型流程列表物理删除(仅删除未启动流程和节点处于第一节点的流程)
     */
    @AuditLog(moduleName = "人员请假数据模型", eventDesc = "流程列表物理删除(仅删除未启动流程和节点处于第一节点的流程)", eventGrade = AuditEventGrade.SERVICE_LOG_TYPE, evnetType = AuditEventType.DELETE)
    @PostMapping("/flowTableDeleteUnStart")
    public ApiResponse<String> flowTableDeleteUnStart(@RequestParam(value = "id") String id) {
        return ryqjsjmxService.flowTableDeleteUnStart(id);
    }
}
